Answer:

Yes, this is very common. Many objects are bundles of primitive data along with some methods to work on that data.

Picture of an Object

string picture

An object consists of both data and methods. The picture illustrates a conceptual object. The little yellow bricks represent bytes of memory. The methods of the object and the data of the object are constructed out of bytes. This object contains the characters "Elementary, my dear Watson!" and contains and several methods to manipulate that data.

A class is the data type of an object. A class describes what an object of a particular type is made of, its data and its methods. A class is merely a description. It is like a plan for a house. Before you build a house, you should have a plan. Once you have a plan, however, you can build any number of similar houses.

The picture represents an object of class String. String objects contain a string of characters, and various methods that can do things with those characters. (There are several dozen methods in a String object. Only a few are shown in the picture.)


 

QUESTION 3:

What do you suppose that the length() method of the String object does?